unit Kwgl_KsXzEditUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Buttons, DB, ADODB, DBCtrls, ExtCtrls, ComCtrls,
  DBClient;

type
  TKwgl_KsXzEditForm = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    Panel1: TPanel;
    DataSource1: TDataSource;
    DBMemo1: TDBMemo;
    BitBtn1: TBitBtn;
    BitBtn2: TBitBtn;
    BitBtn3: TBitBtn;
    ClientDataSet1: TClientDataSet;
    procedure BitBtn1Click(Sender: TObject);
    procedure BitBtn2Click(Sender: TObject);
    procedure BitBtn3Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure FormCreate(Sender: TObject);
    procedure DataSource1StateChange(Sender: TObject);
    procedure ClientDataSet1AfterPost(DataSet: TDataSet);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Kwgl_KsXzEditForm: TKwgl_KsXzEditForm;

implementation
uses Kwgl_RDataUnit;
{$R *.dfm}

procedure TKwgl_KsXzEditForm.BitBtn1Click(Sender: TObject);
begin
  CLientDataSet1.Edit;
  CLientDataSet1.Post;
  clientDataSet1.ApplyUpdates(0);
end;

procedure TKwgl_KsXzEditForm.BitBtn2Click(Sender: TObject);
begin
  CLientDataSet1.Cancel;
end;

procedure TKwgl_KsXzEditForm.BitBtn3Click(Sender: TObject);
begin
  Close;
end;

procedure TKwgl_KsXzEditForm.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  CLientDataSet1.Close;
  Action := caFree;
end;

procedure TKwgl_KsXzEditForm.FormCreate(Sender: TObject);
begin
  //AboutForm.suiSkinEngine1.AddForm(Self);
  CLientDataSet1.Close;
  CLientDataSet1.Open;
end;

procedure TKwgl_KsXzEditForm.DataSource1StateChange(Sender: TObject);
begin
  BitBtn1.Enabled := CLientDataSet1.State in [dsInsert,dsEdit];
  BitBtn2.Enabled := BitBtn1.Enabled;
  BitBtn3.Enabled := not BitBtn1.Enabled;
end;

procedure TKwgl_KsXzEditForm.ClientDataSet1AfterPost(DataSet: TDataSet);
begin
  ClientDataSet1.ApplyUpdates(0);

end;

end.
